.class public Lcom/bitauto/autoeasy/news/Object/FocusImgParser;
.super Ljava/lang/Object;
.source "FocusImgParser.java"


# static fields
.field private static final FIRSTPICURL:Ljava/lang/String; = "imgurl"

.field private static final NEWSID:Ljava/lang/String; = "newsid"

.field private static final TAG:Ljava/lang/String; = "NewsParser"

.field private static final TITLE:Ljava/lang/String; = "title"


# instance fields
.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 29
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 25
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/news/Object/FocusImgParser;->url:Ljava/lang/String;

    .line 30
    return-void
.end method


# virtual methods
.method public Paser2Object()Ljava/util/ArrayList;
    .locals 13
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/news/Object/News;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v10, 0x0

    const-string v12, "error :"

    const-string v11, "NewsParser"

    .line 38
    :try_start_0
    iget-object v8, p0, Lcom/bitauto/autoeasy/news/Object/FocusImgParser;->url:Ljava/lang/String;

    invoke-static {v8}, Lcom/bitauto/autoeasy/tool/Caller;->doGet(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v7

    .line 39
    .local v7, str:Ljava/lang/String;
    if-eqz v7, :cond_2

    .line 40
    new-instance v5, Ljava/util/ArrayList;

    invoke-direct {v5}, Ljava/util/ArrayList;-><init>()V

    .line 41
    .local v5, list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/news/Object/News;>;"
    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3, v7}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 42
    .local v3, jObj:Lorg/json/JSONObject;
    const-string v8, "focusnews"

    invoke-virtual {v3, v8}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v2

    .line 43
    .local v2, jArr:Lorg/json/JSONArray;
    const/4 v6, 0x0

    .line 44
    .local v6, news:Lcom/bitauto/autoeasy/news/Object/News;
    invoke-virtual {v2}, Lorg/json/JSONArray;->length()I

    move-result v4

    .line 45
    .local v4, length:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    if-lt v1, v4, :cond_0

    move-object v8, v5

    .line 58
    .end local v1           #i:I
    .end local v2           #jArr:Lorg/json/JSONArray;
    .end local v3           #jObj:Lorg/json/JSONObject;
    .end local v4           #length:I
    .end local v5           #list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/news/Object/News;>;"
    .end local v6           #news:Lcom/bitauto/autoeasy/news/Object/News;
    .end local v7           #str:Ljava/lang/String;
    :goto_1
    return-object v8

    .line 46
    .restart local v1       #i:I
    .restart local v2       #jArr:Lorg/json/JSONArray;
    .restart local v3       #jObj:Lorg/json/JSONObject;
    .restart local v4       #length:I
    .restart local v5       #list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/news/Object/News;>;"
    .restart local v6       #news:Lcom/bitauto/autoeasy/news/Object/News;
    .restart local v7       #str:Ljava/lang/String;
    :cond_0
    invoke-virtual {v2, v1}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v8

    invoke-virtual {p0, v8}, Lcom/bitauto/autoeasy/news/Object/FocusImgParser;->build(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/news/Object/News;

    move-result-object v6

    .line 47
    if-eqz v6, :cond_1

    .line 48
    invoke-virtual {v5, v6}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Lcom/bitauto/autoeasy/tool/WSError; {:try_start_0 .. :try_end_0} :catch_1

    .line 45
    :cond_1
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .end local v1           #i:I
    .end local v2           #jArr:Lorg/json/JSONArray;
    .end local v3           #jObj:Lorg/json/JSONObject;
    .end local v4           #length:I
    .end local v5           #list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/news/Object/News;>;"
    .end local v6           #news:Lcom/bitauto/autoeasy/news/Object/News;
    :cond_2
    move-object v8, v10

    .line 52
    goto :goto_1

    .line 53
    .end local v7           #str:Ljava/lang/String;
    :catch_0
    move-exception v8

    move-object v0, v8

    .line 54
    .local v0, e:Lorg/json/JSONException;
    const-string v8, "NewsParser"

    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, "error :"

    invoke-direct {v8, v12}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v11, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    move-object v8, v10

    .line 55
    goto :goto_1

    .line 56
    .end local v0           #e:Lorg/json/JSONException;
    :catch_1
    move-exception v8

    move-object v0, v8

    .line 57
    .local v0, e:Lcom/bitauto/autoeasy/tool/WSError;
    const-string v8, "NewsParser"

    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, "error :"

    invoke-direct {v8, v12}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lcom/bitauto/autoeasy/tool/WSError;->getMessage()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v11, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    move-object v8, v10

    .line 58
    goto :goto_1
.end method

.method public build(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/news/Object/News;
    .locals 5
    .parameter "obj"

    .prologue
    .line 69
    new-instance v1, Lcom/bitauto/autoeasy/news/Object/News;

    invoke-direct {v1}, Lcom/bitauto/autoeasy/news/Object/News;-><init>()V

    .line 71
    .local v1, news:Lcom/bitauto/autoeasy/news/Object/News;
    :try_start_0
    const-string v2, "title"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/bitauto/autoeasy/news/Object/News;->setTitle(Ljava/lang/String;)V

    .line 72
    const-string v2, "imgurl"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/bitauto/autoeasy/news/Object/News;->setFirstPicUrl(Ljava/lang/String;)V

    .line 73
    const-string v2, "newsid"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/bitauto/autoeasy/news/Object/News;->setNewsid(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-object v2, v1

    .line 78
    :goto_0
    return-object v2

    .line 75
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 76
    .local v0, e:Lorg/json/JSONException;
    const-string v2, "NewsParser"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "error :"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 77
    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    .line 78
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public setUrl(Ljava/lang/String;)V
    .locals 0
    .parameter "url"

    .prologue
    .line 33
    iput-object p1, p0, Lcom/bitauto/autoeasy/news/Object/FocusImgParser;->url:Ljava/lang/String;

    .line 34
    return-void
.end method
